
/*
    Software License

    Copyright (C) 2021-05-24  Xoronos

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 3.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/*
    Liabilities

    The software is provided "AS IS" without any warranty of any kind, either expressed,
    implied, or statutory, including, but not limited to, any warranty that the software
    will conform to specifications, any implied warranties of merchantability, fitness
    for a particular purpose, and freedom from infringement, and any warranty that the
    documentation will conform to the software, or any warranty that the software will
    be error free.

    In no event shall Xoronos be liable for any damages, including, but not limited to,
    direct, indirect, special or consequential damages, arising out of, resulting from,
    or in any way connected with this software, whether or not based upon warranty,
    contract, tort, or otherwise, whether or not injury was sustained by persons or
    property or otherwise, and whether or not loss was sustained from, or arose out of
    the results of, or use of, the software or services provided hereunder.

    To request the provided software under a different license you can contact us at
    support@xoronos.com
*/

#include "lexcheck_backend.h"

void lex_print_redundant_option( int a, int b, char *all_args[]
 )
{

    snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
              "\nlexer error: the command/option %s should not be used while using %s\n", all_args[a],
              all_args[b] );
    XLEX_PRINT(  );

}

void lex_print_mandatory_message( int a, char *all_args[]
 )
{

    snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the command/option %s must be specified\n",
              all_args[a] );
    XLEX_PRINT(  );

}

void lex_print_relative_mandatory_message( int a, int b, char *all_args[]
 )
{

    snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
              "\nlexer error: the command/option %s must be specified when %s\n", all_args[a], all_args[b] );
    XLEX_PRINT(  );

}

void lex_print_uncompatible_message( int a, int b, char *all_args[]
 )
{

    snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the options %s and %s are not compatible\n",
              all_args[a], all_args[b] );
    XLEX_PRINT(  );

}

int convert_lexconst_to_str( int a, char buffer[XRNL_MAX_STR_SIZE + 1], char *all_args[]
 )
{

    if ( a > XLEN_ALL_ARGS ) {
        return XRNL_ERROR;
    }

    strncpy( buffer, all_args[a], XRNL_MAX_STR_SIZE );
    return XRNL_SUCCESS;

}

int is_valid_password( char *buffer
 )
{

    int has_uppercase;
    int has_lowercase;
    int has_digit;
    int has_special_char;

    has_uppercase = 0;
    has_lowercase = 0;
    has_digit = 0;
    has_special_char = 0;

    while ( *buffer ) {
        if ( isupper( *buffer ) ) {
            has_uppercase = 1;
        } else if ( islower( *buffer ) ) {
            has_lowercase = 2;
        } else if ( isdigit( *buffer ) ) {
            has_digit = 4;
        } else {
            // Check if the character is a special character
            switch ( *buffer ) {
                case '!':
                case '@':
                case '#':
                case '$':
                case '%':
                case '^':
                case '&':
                case '*':
                case '(':
                case ')':
                case '-':
                case '_':
                case '+':
                case '=':
                case '[':
                case ']':
                case '{':
                case '}':
                case '<':
                case '>':
                case '?':
                case '/':
                case '|':
                case '\\':
                case '`':
                case '~':
                case ';':
                case ':':
                    has_special_char = 1;
                    break;
            }

        }

        buffer++;
    }

    if ( has_uppercase == 0 ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "lexer error: the password should have at least an upper case character\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    } else if ( has_lowercase == 0 ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "lexer error: the password should have at least a lower case character\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    } else if ( has_digit == 0 ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "lexer error: the password should have at least a digit character\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    } else if ( has_special_char == 0 ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "lexer error: the password should have at least a special character\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int convert_str_to_lexconts( int i, char buffer[XRNL_MAX_STR_SIZE], int *o, int *arg_type, char *all_args[]
 )
{

    int j;

    *o = -1;

    if ( i == XDC_DECODING_CONF ) {

        if ( !strncmp( buffer, all_args[XDC_COMPILED_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_COMPILED_PARAM;
            *arg_type = XARGDC_COMPILED_PARAM;
        }

        if ( !strncmp( buffer, all_args[XDC_DISPARITY_ERR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_DISPARITY_ERR_TH;
            *arg_type = XARGDC_DISPARITY_ERR_TH;
        }

        if ( !strncmp( buffer, all_args[XDC_DISPARITY_WAR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_DISPARITY_WAR_TH;
            *arg_type = XARGDC_DISPARITY_WAR_TH;
        }

        if ( !strncmp( buffer, all_args[XDC_ENCODING_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_ENCODING_PARAM;
            *arg_type = XARGDC_ENCODING_PARAM;
        }

        if ( !strncmp( buffer, all_args[XDC_NO_DISPARITY_ERR], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_NO_DISPARITY_ERR;
            *arg_type = XARGDC_NO_DISPARITY_ERR;
        }

        if ( !strncmp( buffer, all_args[XDC_NO_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_NO_PARAM;
            *arg_type = XARGDC_NO_PARAM;
        }

        if ( !strncmp( buffer, all_args[XDC_INIT_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_INIT_FILE;
            *arg_type = XARGDC_INIT_FILE;
        }

        if ( !strncmp( buffer, all_args[XDC_NO_PASSWORD], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_NO_PASSWORD;
            *arg_type = XARGDC_NO_PASSWORD;
        }

        if ( !strncmp( buffer, all_args[XDC_NO_RUNNING_ERR], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_NO_RUNNING_ERR;
            *arg_type = XARGDC_NO_RUNNING_ERR;
        }

        if ( !strncmp( buffer, all_args[XDC_PASSWORD_STR], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_PASSWORD_STR;
            *arg_type = XARGDC_PASSWORD_STR;
        }

        if ( !strncmp( buffer, all_args[XDC_RUNNING_ERR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_RUNNING_ERR_TH;
            *arg_type = XARGDC_RUNNING_ERR_TH;
        }

        if ( !strncmp( buffer, all_args[XDC_RUNNING_WAR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XDC_RUNNING_WAR_TH;
            *arg_type = XARGDC_RUNNING_WAR_TH;
        }

    } else if ( i == XEC_ENCODING_CONF ) {

        if ( !strncmp( buffer, all_args[XEC_COMPILED_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_COMPILED_PARAM;
            *arg_type = XARGEC_COMPILED_PARAM;
        }

        if ( !strncmp( buffer, all_args[XEC_DISPARITY_ERR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_DISPARITY_ERR_TH;
            *arg_type = XARGEC_DISPARITY_ERR_TH;
        }

        if ( !strncmp( buffer, all_args[XEC_DISPARITY_WAR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_DISPARITY_WAR_TH;
            *arg_type = XARGEC_DISPARITY_WAR_TH;
        }

        if ( !strncmp( buffer, all_args[XEC_ENCODING_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_ENCODING_PARAM;
            *arg_type = XARGEC_ENCODING_PARAM;
        }

        if ( !strncmp( buffer, all_args[XEC_NO_DISPARITY_ERR], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_NO_DISPARITY_ERR;
            *arg_type = XARGEC_NO_DISPARITY_ERR;
        }

        if ( !strncmp( buffer, all_args[XEC_NO_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_NO_PARAM;
            *arg_type = XARGEC_NO_PARAM;
        }

        if ( !strncmp( buffer, all_args[XEC_INIT_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_INIT_FILE;
            *arg_type = XARGEC_INIT_FILE;
        }

        if ( !strncmp( buffer, all_args[XEC_NO_PASSWORD], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_NO_PASSWORD;
            *arg_type = XARGEC_NO_PASSWORD;
        }

        if ( !strncmp( buffer, all_args[XEC_NO_RUNNING_ERR], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_NO_RUNNING_ERR;
            *arg_type = XARGEC_NO_RUNNING_ERR;
        }

        if ( !strncmp( buffer, all_args[XEC_PASSWORD_STR], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_PASSWORD_STR;
            *arg_type = XARGEC_PASSWORD_STR;
        }

        if ( !strncmp( buffer, all_args[XEC_RUNNING_ERR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_RUNNING_ERR_TH;
            *arg_type = XARGEC_RUNNING_ERR_TH;
        }

        if ( !strncmp( buffer, all_args[XEC_RUNNING_WAR_TH], XRNL_MAX_STR_SIZE ) ) {
            *o = XEC_RUNNING_WAR_TH;
            *arg_type = XARGEC_RUNNING_WAR_TH;
        }

    } else if ( i == XAC_ARITHMETIC_CONF ) {

        if ( !strncmp( buffer, all_args[XAC_ASY_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_ASY_SIGNATURE;
            *arg_type = XARGAC_ASY_SIGNATURE;
        }

        if ( !strncmp( buffer, all_args[XAC_RING_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_RING_SIGNATURE;
            *arg_type = XARGAC_RING_SIGNATURE;
        }

        if ( !strncmp( buffer, all_args[XAC_ASY_CERTIFICATE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_ASY_CERTIFICATE;
            *arg_type = XARGAC_ASY_CERTIFICATE;
        }

        if ( !strncmp( buffer, all_args[XAC_BINOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_BINOMIAL_COMMITMENT;
            *arg_type = XARGAC_BINOMIAL_COMMITMENT;
        }

        if ( !strncmp( buffer, all_args[XAC_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_BINOMIAL_KEY;
            *arg_type = XARGAC_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XAC_HASH], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_HASH;
            *arg_type = XARGAC_HASH;
        }

        if ( !strncmp( buffer, all_args[XAC_MONOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_MONOMIAL_COMMITMENT;
            *arg_type = XARGAC_MONOMIAL_COMMITMENT;
        }

        if ( !strncmp( buffer, all_args[XAC_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_MONOMIAL_KEY;
            *arg_type = XARGAC_MONOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XAC_MONOMIAL_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_MONOMIAL_PROOF;
            *arg_type = XARGAC_MONOMIAL_PROOF;
        }

        if ( !strncmp( buffer, all_args[XAC_SYM_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_SYM_SIGNATURE;
            *arg_type = XARGAC_SYM_SIGNATURE;
        }

        if ( !strncmp( buffer, all_args[XAC_SYM_CERTIFICATE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_SYM_CERTIFICATE;
            *arg_type = XARGAC_SYM_CERTIFICATE;
        }

        if ( !strncmp( buffer, all_args[XAC_MONOMIAL_RESPONSE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_MONOMIAL_RESPONSE;
            *arg_type = XARGAC_MONOMIAL_RESPONSE;
        }

        if ( !strncmp( buffer, all_args[XAC_MONOVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_MONOVALENT_KEY;
            *arg_type = XARGAC_MONOVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XAC_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_POINT;
            *arg_type = XARGAC_POINT;
        }

        if ( !strncmp( buffer, all_args[XAC_POLYVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_POLYVALENT_KEY;
            *arg_type = XARGAC_POLYVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XAC_POLYVALENT_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_POLYVALENT_PROOF;
            *arg_type = XARGAC_POLYVALENT_PROOF;
        }

        if ( !strncmp( buffer, all_args[XAC_START_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_START_POINT;
            *arg_type = XARGAC_START_POINT;
        }

        if ( !strncmp( buffer, all_args[XAC_STATE_SIZE], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_STATE_SIZE;
            *arg_type = XARGAC_STATE_SIZE;
        }

        if ( !strncmp( buffer, all_args[XAC_CRC_BITS], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_CRC_BITS;
            *arg_type = XARGAC_CRC_BITS;
        }

        if ( !strncmp( buffer, all_args[XAC_RND_STR], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_RND_STR;
            *arg_type = XARGAC_RND_STR;
        }

        if ( !strncmp( buffer, all_args[XAC_NO_THREAD], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_NO_THREAD;
            *arg_type = XARGAC_NO_THREAD;
        }

        if ( !strncmp( buffer, all_args[XAC_NO_CONST_EXEC_TIME], XRNL_MAX_STR_SIZE ) ) {
            *o = XAC_NO_CONST_EXEC_TIME;
            *arg_type = XARGAC_NO_CONST_EXEC_TIME;
        }

    } else if ( i == XSC_SEQUENCE_CONF ) {

        if ( !strncmp( buffer, all_args[XSC_XMATRIX_COMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XSC_XMATRIX_COMP;
            *arg_type = XARGSC_XMATRIX_COMP;
        }

        if ( !strncmp( buffer, all_args[XSC_XMATRIX], XRNL_MAX_STR_SIZE ) ) {
            *o = XSC_XMATRIX;
            *arg_type = XARGSC_XMATRIX;
        }

    } else if ( i == XPC_PERMUTATION_CONF ) {

        if ( !strncmp( buffer, all_args[XPC_ARCH], XRNL_MAX_STR_SIZE ) ) {
            *o = XPC_ARCH;
            *arg_type = XARGPC_ARCH;
        }

        if ( !strncmp( buffer, all_args[XPC_SHARED_LIB], XRNL_MAX_STR_SIZE ) ) {
            *o = XPC_SHARED_LIB;
            *arg_type = XARGPC_SHARED_LIB;
        }

    } else if ( i == XLC_LOGGING_CONF ) {

        if ( !strncmp( buffer, all_args[XLC_DEBUG_SEED], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_DEBUG_SEED;
            *arg_type = XARGLC_DEBUG_SEED;
        }

        if ( !strncmp( buffer, all_args[XLC_FORCE_APPEND], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_FORCE_APPEND;
            *arg_type = XARGLC_FORCE_APPEND;
        }

        if ( !strncmp( buffer, all_args[XLC_FORCE_WRITE], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_FORCE_WRITE;
            *arg_type = XARGLC_FORCE_WRITE;
        }

        if ( !strncmp( buffer, all_args[XLC_NO_COMMAND_LINE_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_NO_COMMAND_LINE_LOG;
            *arg_type = XARGLC_NO_COMMAND_LINE_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_COMMAND_LINE_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_COMMAND_LINE_LOG;
            *arg_type = XARGLC_COMMAND_LINE_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_LIB_ERROR_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_LIB_ERROR_LOG;
            *arg_type = XARGLC_LIB_ERROR_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_LIB_WARNING_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_LIB_WARNING_LOG;
            *arg_type = XARGLC_LIB_WARNING_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_LIB_INFO_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_LIB_INFO_LOG;
            *arg_type = XARGLC_LIB_INFO_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_LIB_DEBUG_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_LIB_DEBUG_LOG;
            *arg_type = XARGLC_LIB_DEBUG_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_NO_LIB_ERROR_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_NO_LIB_ERROR_LOG;
            *arg_type = XARGLC_NO_LIB_ERROR_LOG;
        }

        if ( !strncmp( buffer, all_args[XLC_NO_LIB_WARNING_LOG], XRNL_MAX_STR_SIZE ) ) {
            *o = XLC_NO_LIB_WARNING_LOG;
            *arg_type = XARGLC_NO_LIB_WARNING_LOG;
        }

    } else if ( i == XDEP_DUMP_ENCODING_PARAM ) {

        if ( !strncmp( buffer, all_args[XDEP_ENCODING_PARAM], XRNL_MAX_STR_SIZE ) ) {
            *o = XDEP_ENCODING_PARAM;
            *arg_type = XARGDEP_ENCODING_PARAM;
        }

    } else if ( i == XDE_DECODE_ENCODE ) {

        if ( !strncmp( buffer, all_args[XDE_TO_DECODE], XRNL_MAX_STR_SIZE ) ) {
            *o = XDE_TO_DECODE;
            *arg_type = XARGDE_TO_DECODE;
        }

        if ( !strncmp( buffer, all_args[XDE_TO_ENCODE], XRNL_MAX_STR_SIZE ) ) {
            *o = XDE_TO_ENCODE;
            *arg_type = XARGDE_TO_ENCODE;
        }

    } else if ( i == XMXCR_MINE_XMATRIX_COMP_RND ) {

        if ( !strncmp( buffer, all_args[XMXCR_MAX_TRIES], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCR_MAX_TRIES;
            *arg_type = XARGMXCR_MAX_TRIES;
        }

        if ( !strncmp( buffer, all_args[XMXCR_PSEUDO_RANDOM], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCR_PSEUDO_RANDOM;
            *arg_type = XARGMXCR_PSEUDO_RANDOM;
        }

        if ( !strncmp( buffer, all_args[XMXCR_RANDOM], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCR_RANDOM;
            *arg_type = XARGMXCR_RANDOM;
        }

        if ( !strncmp( buffer, all_args[XMXCR_XMATRIX_COMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCR_XMATRIX_COMP;
            *arg_type = XARGMXCR_XMATRIX_COMP;
        }

        if ( !strncmp( buffer, all_args[XMXCR_PROB_ONES], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCR_PROB_ONES;
            *arg_type = XARGMXCR_PROB_ONES;
        }

    } else if ( i == XMXCO_MINE_XMATRIX_COMP_OT ) {

        if ( !strncmp( buffer, all_args[XMXCO_MIN_ONES_PER_ROW], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_MIN_ONES_PER_ROW;
            *arg_type = XARGMXCO_MIN_ONES_PER_ROW;
        }

        if ( !strncmp( buffer, all_args[XMXCO_MAX_ONES_PER_ROW], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_MAX_ONES_PER_ROW;
            *arg_type = XARGMXCO_MAX_ONES_PER_ROW;
        }

        if ( !strncmp( buffer, all_args[XMXCO_MAX_TRIES], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_MAX_TRIES;
            *arg_type = XARGMXCO_MAX_TRIES;
        }

        if ( !strncmp( buffer, all_args[XMXCO_PSEUDO_RANDOM], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_PSEUDO_RANDOM;
            *arg_type = XARGMXCO_PSEUDO_RANDOM;
        }

        if ( !strncmp( buffer, all_args[XMXCO_RANDOM], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_RANDOM;
            *arg_type = XARGMXCO_RANDOM;
        }

        if ( !strncmp( buffer, all_args[XMXCO_XMATRIX_COMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMXCO_XMATRIX_COMP;
            *arg_type = XARGMXCO_XMATRIX_COMP;
        }

    } else if ( i == XPXCR_PERMUTE_XMATRIX_COMP_RANDOM ) {

        if ( !strncmp( buffer, all_args[XPXCR_XMATRIX_COMP_DST], XRNL_MAX_STR_SIZE ) ) {
            *o = XPXCR_XMATRIX_COMP_DST;
            *arg_type = XARGPXCR_XMATRIX_COMP_DST;
        }

    } else if ( i == XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC ) {

        if ( !strncmp( buffer, all_args[XPXCD_XMATRIX_COMP_DST], XRNL_MAX_STR_SIZE ) ) {
            *o = XPXCD_XMATRIX_COMP_DST;
            *arg_type = XARGPXCD_XMATRIX_COMP_DST;
        }

    } else if ( i == XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL ) {

        if ( !strncmp( buffer, all_args[XPXCS_XMATRIX_COMP_DST], XRNL_MAX_STR_SIZE ) ) {
            *o = XPXCS_XMATRIX_COMP_DST;
            *arg_type = XARGPXCS_XMATRIX_COMP_DST;
        }

    } else if ( i == XDX_DECOMPRESS_XMATRIX ) {

        if ( !strncmp( buffer, all_args[XDX_XMATRIX], XRNL_MAX_STR_SIZE ) ) {
            *o = XDX_XMATRIX;
            *arg_type = XARGDX_XMATRIX;
        }

    } else if ( i == XCXC_CHECK_XMATRIX_COMP ) {

    } else if ( i == XCX_CHECK_XMATRIX ) {

    } else if ( i == XMP_MAKE_POINT ) {

        if ( !strncmp( buffer, all_args[XMP_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMP_POINT;
            *arg_type = XARGMP_POINT;
        }

    } else if ( i == XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER ) {

        if ( !strncmp( buffer, all_args[XMSPRN_NEXT_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSPRN_NEXT_POINT;
            *arg_type = XARGMSPRN_NEXT_POINT;
        }

    } else if ( i == XMSP_MAKE_START_POINT ) {

        if ( !strncmp( buffer, all_args[XMSP_START_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSP_START_POINT;
            *arg_type = XARGMSP_START_POINT;
        }

    } else if ( i == XMMK_MAKE_MONOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XMMK_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_MONOMIAL_KEY;
            *arg_type = XARGMMK_MONOMIAL_KEY;
        }

    } else if ( i == XMBK_MAKE_BINOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XMBK_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMBK_BINOMIAL_KEY;
            *arg_type = XARGMBK_BINOMIAL_KEY;
        }

    } else if ( i == XEMK_EXCHANGE_MONOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XEMK_EXTERNAL_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XEMK_EXTERNAL_BINOMIAL_KEY;
            *arg_type = XARGEMK_EXTERNAL_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XEMK_SHARED_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XEMK_SHARED_MONOMIAL_KEY;
            *arg_type = XARGEMK_SHARED_MONOMIAL_KEY;
        }

    } else if ( i == XMMK_MAKE_MONOVALENT_KEY ) {

        if ( !strncmp( buffer, all_args[XMMK_END_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_END_TIMESTAMP;
            *arg_type = XARGMMK_END_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMMK_START_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_START_TIMESTAMP;
            *arg_type = XARGMMK_START_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMMK_MONOVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_MONOVALENT_KEY;
            *arg_type = XARGMMK_MONOVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XMMK_POLYVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_POLYVALENT_KEY;
            *arg_type = XARGMMK_POLYVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XMMK_POLYVALENT_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMK_POLYVALENT_PROOF;
            *arg_type = XARGMMK_POLYVALENT_PROOF;
        }

    } else if ( i == XEPK_EXCHANGE_POLYVALENT_KEY ) {

        if ( !strncmp( buffer, all_args[XEPK_EXTERNAL_MONOVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XEPK_EXTERNAL_MONOVALENT_KEY;
            *arg_type = XARGEPK_EXTERNAL_MONOVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XEPK_SHARED_POLYVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XEPK_SHARED_POLYVALENT_KEY;
            *arg_type = XARGEPK_SHARED_POLYVALENT_KEY;
        }

    } else if ( i == XCMK_CHECK_MONOVALENT_KEY ) {

    } else if ( i == XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XMCBK_BINOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCBK_BINOMIAL_COMMITMENT;
            *arg_type = XARGMCBK_BINOMIAL_COMMITMENT;
        }

        if ( !strncmp( buffer, all_args[XMCBK_MONOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCBK_MONOMIAL_COMMITMENT;
            *arg_type = XARGMCBK_MONOMIAL_COMMITMENT;
        }

    } else if ( i == XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XMCSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCSS_PLAIN_TEXT;
            *arg_type = XARGMCSS_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMCSS_BINOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCSS_BINOMIAL_COMMITMENT;
            *arg_type = XARGMCSS_BINOMIAL_COMMITMENT;
        }

        if ( !strncmp( buffer, all_args[XMCSS_MONOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCSS_MONOMIAL_COMMITMENT;
            *arg_type = XARGMCSS_MONOMIAL_COMMITMENT;
        }

    } else if ( i == XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE ) {

        if ( !strncmp( buffer, all_args[XMCSC_BINOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCSC_BINOMIAL_COMMITMENT;
            *arg_type = XARGMCSC_BINOMIAL_COMMITMENT;
        }

        if ( !strncmp( buffer, all_args[XMCSC_MONOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCSC_MONOMIAL_COMMITMENT;
            *arg_type = XARGMCSC_MONOMIAL_COMMITMENT;
        }

    } else if ( i == XMR_MAKE_RESPONSE ) {

        if ( !strncmp( buffer, all_args[XMR_MONOMIAL_RESPONSE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMR_MONOMIAL_RESPONSE;
            *arg_type = XARGMR_MONOMIAL_RESPONSE;
        }

    } else if ( i == XMMP_MAKE_MONOMIAL_PROOF ) {

        if ( !strncmp( buffer, all_args[XMMP_MONOMIAL_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMP_MONOMIAL_PROOF;
            *arg_type = XARGMMP_MONOMIAL_PROOF;
        }

    } else if ( i == XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XMMPSS_MONOMIAL_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMPSS_MONOMIAL_PROOF;
            *arg_type = XARGMMPSS_MONOMIAL_PROOF;
        }

        if ( !strncmp( buffer, all_args[XMMPSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMPSS_PLAIN_TEXT;
            *arg_type = XARGMMPSS_PLAIN_TEXT;
        }

    } else if ( i == XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE ) {

        if ( !strncmp( buffer, all_args[XMMPSC_MONOMIAL_PROOF], XRNL_MAX_STR_SIZE ) ) {
            *o = XMMPSC_MONOMIAL_PROOF;
            *arg_type = XARGMMPSC_MONOMIAL_PROOF;
        }

    } else if ( i == XCMP_CHECK_MONOMIAL_PROOF ) {

    } else if ( i == XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XCMPSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCMPSS_PLAIN_TEXT;
            *arg_type = XARGCMPSS_PLAIN_TEXT;
        }

    } else if ( i == XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE ) {

    } else if ( i == XMSS_MAKE_SIGNATURE_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XMSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSS_PLAIN_TEXT;
            *arg_type = XARGMSS_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMSS_SYMMETRIC_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSS_SYMMETRIC_SIGNATURE;
            *arg_type = XARGMSS_SYMMETRIC_SIGNATURE;
        }

    } else if ( i == XMSA_MAKE_SIGNATURE_ASYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XMSA_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSA_PLAIN_TEXT;
            *arg_type = XARGMSA_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMSA_ASYMMETRIC_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSA_ASYMMETRIC_SIGNATURE;
            *arg_type = XARGMSA_ASYMMETRIC_SIGNATURE;
        }

    } else if ( i == XMRS_MAKE_RING_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XMRS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMRS_PLAIN_TEXT;
            *arg_type = XARGMRS_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMRS_ADD_DECOY_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMRS_ADD_DECOY_BINOMIAL_KEY;
            *arg_type = XARGMRS_ADD_DECOY_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XMRS_VERIFIER_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMRS_VERIFIER_BINOMIAL_KEY;
            *arg_type = XARGMRS_VERIFIER_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XMRS_RING_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMRS_RING_SIGNATURE;
            *arg_type = XARGMRS_RING_SIGNATURE;
        }

    } else if ( i == XPRS_PERMUTE_RING_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XPRS_SIGNER_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XPRS_SIGNER_BINOMIAL_KEY;
            *arg_type = XARGPRS_SIGNER_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XPRS_VERIFIER_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XPRS_VERIFIER_BINOMIAL_KEY;
            *arg_type = XARGPRS_VERIFIER_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XPRS_SIGNER_RING_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XPRS_SIGNER_RING_SIGNATURE;
            *arg_type = XARGPRS_SIGNER_RING_SIGNATURE;
        }

        if ( !strncmp( buffer, all_args[XPRS_VERIFIER_RING_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XPRS_VERIFIER_RING_SIGNATURE;
            *arg_type = XARGPRS_VERIFIER_RING_SIGNATURE;
        }

        if ( !strncmp( buffer, all_args[XPRS_PERMUTED_RING_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XPRS_PERMUTED_RING_SIGNATURE;
            *arg_type = XARGPRS_PERMUTED_RING_SIGNATURE;
        }

    } else if ( i == XMCS_MAKE_CERTIFICATE_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XMCS_SUBJECT_MONOVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCS_SUBJECT_MONOVALENT_KEY;
            *arg_type = XARGMCS_SUBJECT_MONOVALENT_KEY;
        }

        if ( !strncmp( buffer, all_args[XMCS_SUBJECT_STR], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCS_SUBJECT_STR;
            *arg_type = XARGMCS_SUBJECT_STR;
        }

        if ( !strncmp( buffer, all_args[XMCS_END_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCS_END_TIMESTAMP;
            *arg_type = XARGMCS_END_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMCS_START_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCS_START_TIMESTAMP;
            *arg_type = XARGMCS_START_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMCS_SYMMETRIC_CERTIFICATE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCS_SYMMETRIC_CERTIFICATE;
            *arg_type = XARGMCS_SYMMETRIC_CERTIFICATE;
        }

    } else if ( i == XMCA_MAKE_CERTIFICATE_ASYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XMCA_SUBJECT_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCA_SUBJECT_BINOMIAL_KEY;
            *arg_type = XARGMCA_SUBJECT_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XMCA_SUBJECT_STR], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCA_SUBJECT_STR;
            *arg_type = XARGMCA_SUBJECT_STR;
        }

        if ( !strncmp( buffer, all_args[XMCA_END_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCA_END_TIMESTAMP;
            *arg_type = XARGMCA_END_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMCA_START_TIMESTAMP], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCA_START_TIMESTAMP;
            *arg_type = XARGMCA_START_TIMESTAMP;
        }

        if ( !strncmp( buffer, all_args[XMCA_ASYMMETRIC_CERTIFICATE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMCA_ASYMMETRIC_CERTIFICATE;
            *arg_type = XARGMCA_ASYMMETRIC_CERTIFICATE;
        }

    } else if ( i == XCSS_CHECK_SIGNATURE_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XCSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCSS_PLAIN_TEXT;
            *arg_type = XARGCSS_PLAIN_TEXT;
        }

    } else if ( i == XCSA_CHECK_SIGNATURE_ASYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XCSA_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCSA_PLAIN_TEXT;
            *arg_type = XARGCSA_PLAIN_TEXT;
        }

    } else if ( i == XCRS_CHECK_RING_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XCRS_SIGNER_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCRS_SIGNER_BINOMIAL_KEY;
            *arg_type = XARGCRS_SIGNER_BINOMIAL_KEY;
        }

        if ( !strncmp( buffer, all_args[XCRS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCRS_PLAIN_TEXT;
            *arg_type = XARGCRS_PLAIN_TEXT;
        }

    } else if ( i == XCCS_CHECK_CERTIFICATE_SYMMETRIC ) {

    } else if ( i == XCCA_CHECK_CERTIFICATE_ASYMMETRIC ) {

    } else if ( i == XMH_MAKE_HASH ) {

        if ( !strncmp( buffer, all_args[XMH_HASH], XRNL_MAX_STR_SIZE ) ) {
            *o = XMH_HASH;
            *arg_type = XARGMH_HASH;
        }

        if ( !strncmp( buffer, all_args[XMH_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMH_PLAIN_TEXT;
            *arg_type = XARGMH_PLAIN_TEXT;
        }

    } else if ( i == XMC_MAKE_CHECKSUM ) {

        if ( !strncmp( buffer, all_args[XMC_CHECKSUM_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMC_CHECKSUM_TEXT;
            *arg_type = XARGMC_CHECKSUM_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMC_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMC_PLAIN_TEXT;
            *arg_type = XARGMC_PLAIN_TEXT;
        }

    } else if ( i == XCC_CHECK_CHECKSUM ) {

        if ( !strncmp( buffer, all_args[XCC_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCC_PLAIN_TEXT;
            *arg_type = XARGCC_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XCC_CHECKSUM_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCC_CHECKSUM_TEXT;
            *arg_type = XARGCC_CHECKSUM_TEXT;
        }

    } else if ( i == XCH_CHECK_HASH ) {

        if ( !strncmp( buffer, all_args[XCH_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCH_PLAIN_TEXT;
            *arg_type = XARGCH_PLAIN_TEXT;
        }

    } else if ( i == XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCHTMK_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCHTMK_MONOMIAL_KEY;
            *arg_type = XARGCHTMK_MONOMIAL_KEY;
        }

    } else if ( i == XCHTP_CONVERT_HASH_TO_POINT ) {

        if ( !strncmp( buffer, all_args[XCHTP_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCHTP_POINT;
            *arg_type = XARGCHTP_POINT;
        }

    } else if ( i == XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCPTMK_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCPTMK_MONOMIAL_KEY;
            *arg_type = XARGCPTMK_MONOMIAL_KEY;
        }

    } else if ( i == XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT ) {

        if ( !strncmp( buffer, all_args[XCMKTP_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCMKTP_POINT;
            *arg_type = XARGCMKTP_POINT;
        }

    } else if ( i == XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT ) {

        if ( !strncmp( buffer, all_args[XCBKTSP_START_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCBKTSP_START_POINT;
            *arg_type = XARGCBKTSP_START_POINT;
        }

    } else if ( i == XCSPTP_CONVERT_START_POINT_TO_POINT ) {

        if ( !strncmp( buffer, all_args[XCSPTP_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCSPTP_POINT;
            *arg_type = XARGCSPTP_POINT;
        }

    } else if ( i == XCPTSP_CONVERT_POINT_TO_START_POINT ) {

        if ( !strncmp( buffer, all_args[XCPTSP_START_POINT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCPTSP_START_POINT;
            *arg_type = XARGCPTSP_START_POINT;
        }

    } else if ( i == XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT ) {

        if ( !strncmp( buffer, all_args[XCMKTMC_MONOMIAL_COMMITMENT], XRNL_MAX_STR_SIZE ) ) {
            *o = XCMKTMC_MONOMIAL_COMMITMENT;
            *arg_type = XARGCMKTMC_MONOMIAL_COMMITMENT;
        }

    } else if ( i == XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCMCTMK_MONOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCMCTMK_MONOMIAL_KEY;
            *arg_type = XARGCMCTMK_MONOMIAL_KEY;
        }

    } else if ( i == XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY ) {

        if ( !strncmp( buffer, all_args[XCSCTMK_MONOVALENT_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCSCTMK_MONOVALENT_KEY;
            *arg_type = XARGCSCTMK_MONOVALENT_KEY;
        }

    } else if ( i == XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCACTBK_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCACTBK_BINOMIAL_KEY;
            *arg_type = XARGCACTBK_BINOMIAL_KEY;
        }

    } else if ( i == XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCSSTBK_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCSSTBK_BINOMIAL_KEY;
            *arg_type = XARGCSSTBK_BINOMIAL_KEY;
        }

    } else if ( i == XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {

        if ( !strncmp( buffer, all_args[XCASTBK_BINOMIAL_KEY], XRNL_MAX_STR_SIZE ) ) {
            *o = XCASTBK_BINOMIAL_KEY;
            *arg_type = XARGCASTBK_BINOMIAL_KEY;
        }

    } else if ( i == XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XCBKTAS_ASYMMETRIC_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XCBKTAS_ASYMMETRIC_SIGNATURE;
            *arg_type = XARGCBKTAS_ASYMMETRIC_SIGNATURE;
        }

    } else if ( i == XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE ) {

        if ( !strncmp( buffer, all_args[XCBKTSS_SYMMETRIC_SIGNATURE], XRNL_MAX_STR_SIZE ) ) {
            *o = XCBKTSS_SYMMETRIC_SIGNATURE;
            *arg_type = XARGCBKTSS_SYMMETRIC_SIGNATURE;
        }

    } else if ( i == XSS_SPLIT_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XSS_CHALLENGE_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XSS_CHALLENGE_TEXT;
            *arg_type = XARGSS_CHALLENGE_TEXT;
        }

        if ( !strncmp( buffer, all_args[XSS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XSS_PLAIN_TEXT;
            *arg_type = XARGSS_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XSS_SOLUTION_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XSS_SOLUTION_TEXT;
            *arg_type = XARGSS_SOLUTION_TEXT;
        }

    } else if ( i == XEA_ENCRYPT_ASYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XEA_CIPHER_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XEA_CIPHER_TEXT;
            *arg_type = XARGEA_CIPHER_TEXT;
        }

        if ( !strncmp( buffer, all_args[XEA_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XEA_PLAIN_TEXT;
            *arg_type = XARGEA_PLAIN_TEXT;
        }

    } else if ( i == XES_ENCRYPT_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XES_CIPHER_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XES_CIPHER_TEXT;
            *arg_type = XARGES_CIPHER_TEXT;
        }

        if ( !strncmp( buffer, all_args[XES_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XES_PLAIN_TEXT;
            *arg_type = XARGES_PLAIN_TEXT;
        }

    } else if ( i == XJS_JOIN_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XJS_CHALLENGE_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XJS_CHALLENGE_TEXT;
            *arg_type = XARGJS_CHALLENGE_TEXT;
        }

        if ( !strncmp( buffer, all_args[XJS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XJS_PLAIN_TEXT;
            *arg_type = XARGJS_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XJS_SOLUTION_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XJS_SOLUTION_TEXT;
            *arg_type = XARGJS_SOLUTION_TEXT;
        }

    } else if ( i == XDA_DECIPHER_ASYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XDA_CIPHER_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XDA_CIPHER_TEXT;
            *arg_type = XARGDA_CIPHER_TEXT;
        }

        if ( !strncmp( buffer, all_args[XDA_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XDA_PLAIN_TEXT;
            *arg_type = XARGDA_PLAIN_TEXT;
        }

    } else if ( i == XDS_DECIPHER_SYMMETRIC ) {

        if ( !strncmp( buffer, all_args[XDS_CIPHER_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XDS_CIPHER_TEXT;
            *arg_type = XARGDS_CIPHER_TEXT;
        }

        if ( !strncmp( buffer, all_args[XDS_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XDS_PLAIN_TEXT;
            *arg_type = XARGDS_PLAIN_TEXT;
        }

    } else if ( i == XCCB_CHECK_COMPLETE_BLOCK ) {

        if ( !strncmp( buffer, all_args[XCCB_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XCCB_BLOCK_FILE;
            *arg_type = XARGCCB_BLOCK_FILE;
        }

    } else if ( i == XMB_MAKE_BLOCK ) {

        if ( !strncmp( buffer, all_args[XMB_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMB_BLOCK_FILE;
            *arg_type = XARGMB_BLOCK_FILE;
        }

        if ( !strncmp( buffer, all_args[XMB_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XMB_PLAIN_TEXT;
            *arg_type = XARGMB_PLAIN_TEXT;
        }

        if ( !strncmp( buffer, all_args[XMB_OFFSET], XRNL_MAX_STR_SIZE ) ) {
            *o = XMB_OFFSET;
            *arg_type = XARGMB_OFFSET;
        }

        if ( !strncmp( buffer, all_args[XMB_LENGTH], XRNL_MAX_STR_SIZE ) ) {
            *o = XMB_LENGTH;
            *arg_type = XARGMB_LENGTH;
        }

        if ( !strncmp( buffer, all_args[XMB_TAG], XRNL_MAX_STR_SIZE ) ) {
            *o = XMB_TAG;
            *arg_type = XARGMB_TAG;
        }

    } else if ( i == XCB_COMBINE_BLOCKS ) {

        if ( !strncmp( buffer, all_args[XCB_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XCB_BLOCK_FILE;
            *arg_type = XARGCB_BLOCK_FILE;
        }

        if ( !strncmp( buffer, all_args[XCB_COMBINED_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XCB_COMBINED_BLOCK_FILE;
            *arg_type = XARGCB_COMBINED_BLOCK_FILE;
        }

    } else if ( i == XSHFB_STRIP_HEADER_FROM_BLOCK ) {

        if ( !strncmp( buffer, all_args[XSHFB_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XSHFB_BLOCK_FILE;
            *arg_type = XARGSHFB_BLOCK_FILE;
        }

        if ( !strncmp( buffer, all_args[XSHFB_PLAIN_TEXT], XRNL_MAX_STR_SIZE ) ) {
            *o = XSHFB_PLAIN_TEXT;
            *arg_type = XARGSHFB_PLAIN_TEXT;
        }

    } else if ( i == XPH_PRINT_HEADER ) {

        if ( !strncmp( buffer, all_args[XPH_XRN_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XPH_XRN_FILE;
            *arg_type = XARGPH_XRN_FILE;
        }

    } else if ( i == XPLI_PRINT_LIB_INFO ) {

    } else if ( i == XGC_GET_CAPACITY ) {

        if ( !strncmp( buffer, all_args[XGC_ENVELOP_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XGC_ENVELOP_FILE;
            *arg_type = XARGGC_ENVELOP_FILE;
        }

        if ( !strncmp( buffer, all_args[XGC_DISABLE_FOLDING], XRNL_MAX_STR_SIZE ) ) {
            *o = XGC_DISABLE_FOLDING;
            *arg_type = XARGGC_DISABLE_FOLDING;
        }

    } else if ( i == XMSB_MAKE_STEGANOGRAPHY_BLOCK ) {

        if ( !strncmp( buffer, all_args[XMSB_SOURCE_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_SOURCE_FILE;
            *arg_type = XARGMSB_SOURCE_FILE;
        }

        if ( !strncmp( buffer, all_args[XMSB_ENVELOP_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_ENVELOP_FILE;
            *arg_type = XARGMSB_ENVELOP_FILE;
        }

        if ( !strncmp( buffer, all_args[XMSB_EMBEDDED_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_EMBEDDED_FILE;
            *arg_type = XARGMSB_EMBEDDED_FILE;
        }

        if ( !strncmp( buffer, all_args[XMSB_DISABLE_FOLDING], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_DISABLE_FOLDING;
            *arg_type = XARGMSB_DISABLE_FOLDING;
        }

        if ( !strncmp( buffer, all_args[XMSB_OFFSET], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_OFFSET;
            *arg_type = XARGMSB_OFFSET;
        }

        if ( !strncmp( buffer, all_args[XMSB_LENGTH], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_LENGTH;
            *arg_type = XARGMSB_LENGTH;
        }

        if ( !strncmp( buffer, all_args[XMSB_TAG], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSB_TAG;
            *arg_type = XARGMSB_TAG;
        }

    } else if ( i == XMSR_MAKE_STEGANOGRAPHY_RAW ) {

        if ( !strncmp( buffer, all_args[XMSR_SOURCE_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSR_SOURCE_FILE;
            *arg_type = XARGMSR_SOURCE_FILE;
        }

        if ( !strncmp( buffer, all_args[XMSR_ENVELOP_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSR_ENVELOP_FILE;
            *arg_type = XARGMSR_ENVELOP_FILE;
        }

        if ( !strncmp( buffer, all_args[XMSR_EMBEDDED_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XMSR_EMBEDDED_FILE;
            *arg_type = XARGMSR_EMBEDDED_FILE;
        }

    } else if ( i == XESR_EXTRACT_STEGANOGRAPHY_RAW ) {

        if ( !strncmp( buffer, all_args[XESR_EMBEDDED_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XESR_EMBEDDED_FILE;
            *arg_type = XARGESR_EMBEDDED_FILE;
        }

        if ( !strncmp( buffer, all_args[XESR_RAW_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XESR_RAW_FILE;
            *arg_type = XARGESR_RAW_FILE;
        }

    } else if ( i == XESB_EXTRACT_STEGANOGRAPHY_BLOCK ) {

        if ( !strncmp( buffer, all_args[XESB_EMBEDDED_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XESB_EMBEDDED_FILE;
            *arg_type = XARGESB_EMBEDDED_FILE;
        }

        if ( !strncmp( buffer, all_args[XESB_BLOCK_FILE], XRNL_MAX_STR_SIZE ) ) {
            *o = XESB_BLOCK_FILE;
            *arg_type = XARGESB_BLOCK_FILE;
        }

    }

    // if the previous if clause did not find any match

    if ( *o == -1 ) {

        for ( j = 0; j < XLEN_ALL_ARGS; j++ ) {
            if ( !strncmp( buffer, all_args[j], 48 ) ) {
                *o = j;
                if ( j == XH_HELP ) {
                    *arg_type = XARGH_HELP;
                } else if ( j == XS_SCRIPT ) {
                    *arg_type = XARGS_SCRIPT;
                } else if ( j == XE_EXAMPLE ) {
                    *arg_type = XARGE_EXAMPLE;
                } else {
                    *arg_type = XARG_NULL;
                }

            }

        }

    }

    if ( *o == -1 ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "lexer error: no option or command found\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    return XRNL_SUCCESS;

}

int check_options_of_commands( int current_command, int current_option_or_command, int *next_command,
                               char *all_args[]
 )
{

    int i, next_command_tmp, valid_option, command_found;
    int all_commands[] = XALL_COMM;

    valid_option = 0;
    command_found = 0;

    for ( i = 0; i < XLEN_ALL_COMM; i++ ) {
        if ( current_option_or_command == all_commands[i] ) {
            command_found = 1;
            valid_option = 1;
        }

    }

    if ( current_command == XDC_DECODING_CONF ) {

        if ( ( current_option_or_command == XDC_COMPILED_PARAM ) ||
             ( current_option_or_command == XDC_ENCODING_PARAM ) ||
             ( current_option_or_command == XDC_NO_PARAM ) ||
             ( current_option_or_command == XDC_INIT_FILE ) ||
             ( current_option_or_command == XDC_NO_PASSWORD ) ||
             ( current_option_or_command == XDC_PASSWORD_STR ) ||
             ( current_option_or_command == XDC_NO_RUNNING_ERR ) ||
             ( current_option_or_command == XDC_RUNNING_ERR_TH ) ||
             ( current_option_or_command == XDC_RUNNING_WAR_TH ) ||
             ( current_option_or_command == XDC_NO_DISPARITY_ERR ) ||
             ( current_option_or_command == XDC_DISPARITY_ERR_TH ) ||
             ( current_option_or_command == XDC_DISPARITY_WAR_TH ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XEC_ENCODING_CONF ) {

        if ( ( current_option_or_command == XEC_COMPILED_PARAM ) ||
             ( current_option_or_command == XEC_ENCODING_PARAM ) ||
             ( current_option_or_command == XEC_NO_PARAM ) ||
             ( current_option_or_command == XEC_INIT_FILE ) ||
             ( current_option_or_command == XEC_NO_PASSWORD ) ||
             ( current_option_or_command == XEC_PASSWORD_STR ) ||
             ( current_option_or_command == XEC_NO_RUNNING_ERR ) ||
             ( current_option_or_command == XEC_RUNNING_ERR_TH ) ||
             ( current_option_or_command == XEC_RUNNING_WAR_TH ) ||
             ( current_option_or_command == XEC_NO_DISPARITY_ERR ) ||
             ( current_option_or_command == XEC_DISPARITY_ERR_TH ) ||
             ( current_option_or_command == XEC_DISPARITY_WAR_TH ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XAC_ARITHMETIC_CONF ) {

        if ( ( current_option_or_command == XAC_POINT ) ||
             ( current_option_or_command == XAC_BINOMIAL_KEY ) ||
             ( current_option_or_command == XAC_MONOMIAL_KEY ) ||
             ( current_option_or_command == XAC_START_POINT ) ||
             ( current_option_or_command == XAC_MONOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XAC_BINOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XAC_MONOMIAL_RESPONSE ) ||
             ( current_option_or_command == XAC_MONOMIAL_PROOF ) ||
             ( current_option_or_command == XAC_MONOVALENT_KEY ) ||
             ( current_option_or_command == XAC_POLYVALENT_PROOF ) ||
             ( current_option_or_command == XAC_POLYVALENT_KEY ) ||
             ( current_option_or_command == XAC_SYM_SIGNATURE ) ||
             ( current_option_or_command == XAC_ASY_SIGNATURE ) ||
             ( current_option_or_command == XAC_RING_SIGNATURE ) ||
             ( current_option_or_command == XAC_HASH ) ||
             ( current_option_or_command == XAC_SYM_CERTIFICATE ) ||
             ( current_option_or_command == XAC_ASY_CERTIFICATE ) ||
             ( current_option_or_command == XAC_STATE_SIZE ) ||
             ( current_option_or_command == XAC_CRC_BITS ) ||
             ( current_option_or_command == XAC_RND_STR ) ||
             ( current_option_or_command == XAC_NO_THREAD ) ||
             ( current_option_or_command == XAC_NO_CONST_EXEC_TIME ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XSC_SEQUENCE_CONF ) {

        if ( ( current_option_or_command == XSC_XMATRIX_COMP ) ||
             ( current_option_or_command == XSC_XMATRIX ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPC_PERMUTATION_CONF ) {

        if ( ( current_option_or_command == XPC_ARCH ) || ( current_option_or_command == XPC_SHARED_LIB ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XLC_LOGGING_CONF ) {

        if ( ( current_option_or_command == XLC_LIB_ERROR_LOG ) ||
             ( current_option_or_command == XLC_LIB_WARNING_LOG ) ||
             ( current_option_or_command == XLC_LIB_INFO_LOG ) ||
             ( current_option_or_command == XLC_LIB_DEBUG_LOG ) ||
             ( current_option_or_command == XLC_NO_LIB_ERROR_LOG ) ||
             ( current_option_or_command == XLC_NO_LIB_WARNING_LOG ) ||
             ( current_option_or_command == XLC_COMMAND_LINE_LOG ) ||
             ( current_option_or_command == XLC_NO_COMMAND_LINE_LOG ) ||
             ( current_option_or_command == XLC_DEBUG_SEED ) ||
             ( current_option_or_command == XLC_FORCE_WRITE ) ||
             ( current_option_or_command == XLC_FORCE_APPEND )
             ) {
            valid_option = 1;
        }

    } else if ( current_command == XDEP_DUMP_ENCODING_PARAM ) {

        if ( ( current_option_or_command == XDEP_ENCODING_PARAM ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XDE_DECODE_ENCODE ) {

        if ( ( current_option_or_command == XDE_TO_DECODE ) ||
             ( current_option_or_command == XDE_TO_ENCODE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMXCR_MINE_XMATRIX_COMP_RND ) {

        if ( ( current_option_or_command == XMXCR_PROB_ONES ) ||
             ( current_option_or_command == XMXCR_MAX_TRIES ) ||
             ( current_option_or_command == XMXCR_XMATRIX_COMP ) ||
             ( current_option_or_command == XMXCR_RANDOM ) ||
             ( current_option_or_command == XMXCR_PSEUDO_RANDOM ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMXCO_MINE_XMATRIX_COMP_OT ) {

        if ( ( current_option_or_command == XMXCO_MIN_ONES_PER_ROW ) ||
             ( current_option_or_command == XMXCO_MAX_ONES_PER_ROW ) ||
             ( current_option_or_command == XMXCO_MAX_TRIES ) ||
             ( current_option_or_command == XMXCO_XMATRIX_COMP ) ||
             ( current_option_or_command == XMXCO_RANDOM ) ||
             ( current_option_or_command == XMXCO_PSEUDO_RANDOM ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPXCR_PERMUTE_XMATRIX_COMP_RANDOM ) {

        if ( ( current_option_or_command == XPXCR_XMATRIX_COMP_DST ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC ) {

        if ( ( current_option_or_command == XPXCD_XMATRIX_COMP_DST ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL ) {

        if ( ( current_option_or_command == XPXCS_XMATRIX_COMP_DST ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XDX_DECOMPRESS_XMATRIX ) {

        if ( ( current_option_or_command == XDX_XMATRIX ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCXC_CHECK_XMATRIX_COMP ) {

    } else if ( current_command == XCX_CHECK_XMATRIX ) {

    } else if ( current_command == XMP_MAKE_POINT ) {

        if ( ( current_option_or_command == XMP_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER ) {

        if ( ( current_option_or_command == XMSPRN_NEXT_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMSP_MAKE_START_POINT ) {

        if ( ( current_option_or_command == XMSP_START_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMMK_MAKE_MONOMIAL_KEY ) {

        if ( ( current_option_or_command == XMMK_MONOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMBK_MAKE_BINOMIAL_KEY ) {

        if ( ( current_option_or_command == XMBK_BINOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XEMK_EXCHANGE_MONOMIAL_KEY ) {

        if ( ( current_option_or_command == XEMK_EXTERNAL_BINOMIAL_KEY ) ||
             ( current_option_or_command == XEMK_SHARED_MONOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMMK_MAKE_MONOVALENT_KEY ) {

        if ( ( current_option_or_command == XMMK_MONOVALENT_KEY ) ||
             ( current_option_or_command == XMMK_POLYVALENT_KEY ) ||
             ( current_option_or_command == XMMK_POLYVALENT_PROOF ) ||
             ( current_option_or_command == XMMK_START_TIMESTAMP ) ||
             ( current_option_or_command == XMMK_END_TIMESTAMP ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XEPK_EXCHANGE_POLYVALENT_KEY ) {

        if ( ( current_option_or_command == XEPK_EXTERNAL_MONOVALENT_KEY ) ||
             ( current_option_or_command == XEPK_SHARED_POLYVALENT_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMK_CHECK_MONOVALENT_KEY ) {

    } else if ( current_command == XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY ) {

        if ( ( current_option_or_command == XMCBK_MONOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XMCBK_BINOMIAL_COMMITMENT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE ) {

        if ( ( current_option_or_command == XMCSS_MONOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XMCSS_BINOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XMCSS_PLAIN_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE ) {

        if ( ( current_option_or_command == XMCSC_MONOMIAL_COMMITMENT ) ||
             ( current_option_or_command == XMCSC_BINOMIAL_COMMITMENT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMR_MAKE_RESPONSE ) {

        if ( ( current_option_or_command == XMR_MONOMIAL_RESPONSE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMMP_MAKE_MONOMIAL_PROOF ) {

        if ( ( current_option_or_command == XMMP_MONOMIAL_PROOF ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE ) {

        if ( ( current_option_or_command == XMMPSS_MONOMIAL_PROOF ) ||
             ( current_option_or_command == XMMPSS_PLAIN_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE ) {

        if ( current_option_or_command == XMMPSC_MONOMIAL_PROOF ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMP_CHECK_MONOMIAL_PROOF ) {

    } else if ( current_command == XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE ) {

        if ( current_option_or_command == XCMPSS_PLAIN_TEXT ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE ) {

    } else if ( current_command == XMSS_MAKE_SIGNATURE_SYMMETRIC ) {

        if ( ( current_option_or_command == XMSS_PLAIN_TEXT ) ||
             ( current_option_or_command == XMSS_SYMMETRIC_SIGNATURE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMSA_MAKE_SIGNATURE_ASYMMETRIC ) {

        if ( ( current_option_or_command == XMSA_PLAIN_TEXT ) ||
             ( current_option_or_command == XMSA_ASYMMETRIC_SIGNATURE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPRS_PERMUTE_RING_SIGNATURE ) {

        if ( ( current_option_or_command == XPRS_SIGNER_BINOMIAL_KEY ) ||
             ( current_option_or_command == XPRS_VERIFIER_BINOMIAL_KEY ) ||
             ( current_option_or_command == XPRS_SIGNER_RING_SIGNATURE ) ||
             ( current_option_or_command == XPRS_VERIFIER_RING_SIGNATURE ) ||
             ( current_option_or_command == XPRS_PERMUTED_RING_SIGNATURE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMRS_MAKE_RING_SIGNATURE ) {

        if ( ( current_option_or_command == XMRS_ADD_DECOY_BINOMIAL_KEY ) ||
             ( current_option_or_command == XMRS_PLAIN_TEXT ) ||
             ( current_option_or_command == XMRS_RING_SIGNATURE ) ||
             ( current_option_or_command == XMRS_VERIFIER_BINOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMCS_MAKE_CERTIFICATE_SYMMETRIC ) {

        if ( ( current_option_or_command == XMCS_SYMMETRIC_CERTIFICATE ) ||
             ( current_option_or_command == XMCS_START_TIMESTAMP ) ||
             ( current_option_or_command == XMCS_SUBJECT_MONOVALENT_KEY ) ||
             ( current_option_or_command == XMCS_SUBJECT_STR ) ||
             ( current_option_or_command == XMCS_END_TIMESTAMP ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMCA_MAKE_CERTIFICATE_ASYMMETRIC ) {

        if ( ( current_option_or_command == XMCA_ASYMMETRIC_CERTIFICATE ) ||
             ( current_option_or_command == XMCA_START_TIMESTAMP ) ||
             ( current_option_or_command == XMCA_SUBJECT_BINOMIAL_KEY ) ||
             ( current_option_or_command == XMCA_SUBJECT_STR ) ||
             ( current_option_or_command == XMCA_END_TIMESTAMP ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCSS_CHECK_SIGNATURE_SYMMETRIC ) {

        if ( current_option_or_command == XCSS_PLAIN_TEXT ) {
            valid_option = 1;
        }

    } else if ( current_command == XCSA_CHECK_SIGNATURE_ASYMMETRIC ) {

        if ( current_option_or_command == XCSA_PLAIN_TEXT ) {
            valid_option = 1;
        }

    } else if ( current_command == XCRS_CHECK_RING_SIGNATURE ) {

        if ( ( current_option_or_command == XCRS_SIGNER_BINOMIAL_KEY ) ||
             ( current_option_or_command == XCRS_PLAIN_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCCS_CHECK_CERTIFICATE_SYMMETRIC ) {

    } else if ( current_command == XCCA_CHECK_CERTIFICATE_ASYMMETRIC ) {

    } else if ( current_command == XMH_MAKE_HASH ) {

        if ( ( current_option_or_command == XMH_PLAIN_TEXT ) || ( current_option_or_command == XMH_HASH ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMC_MAKE_CHECKSUM ) {

        if ( ( current_option_or_command == XMC_PLAIN_TEXT ) ||
             ( current_option_or_command == XMC_CHECKSUM_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCC_CHECK_CHECKSUM ) {

        if ( ( current_option_or_command == XCC_PLAIN_TEXT ) ||
             ( current_option_or_command == XCC_CHECKSUM_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCH_CHECK_HASH ) {

        if ( current_option_or_command == XCH_PLAIN_TEXT ) {
            valid_option = 1;
        }

    } else if ( current_command == XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY ) {

        if ( ( current_option_or_command == XCHTMK_MONOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCHTP_CONVERT_HASH_TO_POINT ) {

        if ( ( current_option_or_command == XCHTP_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY ) {

        if ( ( current_option_or_command == XCPTMK_MONOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT ) {

        if ( ( current_option_or_command == XCMKTP_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT ) {

        if ( ( current_option_or_command == XCBKTSP_START_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCSPTP_CONVERT_START_POINT_TO_POINT ) {

        if ( ( current_option_or_command == XCSPTP_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCPTSP_CONVERT_POINT_TO_START_POINT ) {

        if ( ( current_option_or_command == XCPTSP_START_POINT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT ) {

        if ( ( current_option_or_command == XCMKTMC_MONOMIAL_COMMITMENT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY ) {

        if ( ( current_option_or_command == XCMCTMK_MONOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY ) {

        if ( ( current_option_or_command == XCSCTMK_MONOVALENT_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY ) {

        if ( ( current_option_or_command == XCACTBK_BINOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {

        if ( ( current_option_or_command == XCASTBK_BINOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {

        if ( ( current_option_or_command == XCSSTBK_BINOMIAL_KEY ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE ) {

        if ( ( current_option_or_command == XCBKTAS_ASYMMETRIC_SIGNATURE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE ) {

        if ( ( current_option_or_command == XCBKTSS_SYMMETRIC_SIGNATURE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XSS_SPLIT_SYMMETRIC ) {

        if ( ( current_option_or_command == XSS_PLAIN_TEXT ) ||
             ( current_option_or_command == XSS_CHALLENGE_TEXT ) ||
             ( current_option_or_command == XSS_SOLUTION_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XEA_ENCRYPT_ASYMMETRIC ) {

        if ( ( current_option_or_command == XEA_PLAIN_TEXT ) ||
             ( current_option_or_command == XEA_CIPHER_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XES_ENCRYPT_SYMMETRIC ) {

        if ( ( current_option_or_command == XES_PLAIN_TEXT ) ||
             ( current_option_or_command == XES_CIPHER_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XJS_JOIN_SYMMETRIC ) {

        if ( ( current_option_or_command == XJS_PLAIN_TEXT ) ||
             ( current_option_or_command == XJS_CHALLENGE_TEXT ) ||
             ( current_option_or_command == XJS_SOLUTION_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XDA_DECIPHER_ASYMMETRIC ) {

        if ( ( current_option_or_command == XDA_PLAIN_TEXT ) ||
             ( current_option_or_command == XDA_CIPHER_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XDS_DECIPHER_SYMMETRIC ) {

        if ( ( current_option_or_command == XDS_PLAIN_TEXT ) ||
             ( current_option_or_command == XDS_CIPHER_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XCCB_CHECK_COMPLETE_BLOCK ) {

        if ( current_option_or_command == XCCB_BLOCK_FILE ) {
            valid_option = 1;
        }

    } else if ( current_command == XMB_MAKE_BLOCK ) {

        if ( ( current_option_or_command == XMB_OFFSET ) ||
             ( current_option_or_command == XMB_LENGTH ) ||
             ( current_option_or_command == XMB_TAG ) ||
             ( current_option_or_command == XMB_PLAIN_TEXT ) ||
             ( current_option_or_command == XMB_BLOCK_FILE )
             ) {
            valid_option = 1;
        }

    } else if ( current_command == XCB_COMBINE_BLOCKS ) {

        if ( ( current_option_or_command == XCB_BLOCK_FILE ) ||
             ( current_option_or_command == XCB_COMBINED_BLOCK_FILE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XSHFB_STRIP_HEADER_FROM_BLOCK ) {

        if ( ( current_option_or_command == XSHFB_BLOCK_FILE ) ||
             ( current_option_or_command == XSHFB_PLAIN_TEXT ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XPH_PRINT_HEADER ) {

        if ( current_option_or_command == XPH_XRN_FILE ) {
            valid_option = 1;
        }

    } else if ( current_command == XGC_GET_CAPACITY ) {

        if ( ( current_option_or_command == XGC_ENVELOP_FILE ) ||
             ( current_option_or_command == XGC_DISABLE_FOLDING ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XMSB_MAKE_STEGANOGRAPHY_BLOCK ) {

        if ( ( current_option_or_command == XMSB_OFFSET ) ||
             ( current_option_or_command == XMSB_LENGTH ) ||
             ( current_option_or_command == XMSB_TAG ) ||
             ( current_option_or_command == XMSB_SOURCE_FILE ) ||
             ( current_option_or_command == XMSB_ENVELOP_FILE ) ||
             ( current_option_or_command == XMSB_EMBEDDED_FILE ) ||
             ( current_option_or_command == XMSB_DISABLE_FOLDING )
             ) {
            valid_option = 1;
        }

    } else if ( current_command == XMSR_MAKE_STEGANOGRAPHY_RAW ) {

        if ( ( current_option_or_command == XMSR_SOURCE_FILE ) ||
             ( current_option_or_command == XMSR_ENVELOP_FILE ) ||
             ( current_option_or_command == XMSR_EMBEDDED_FILE )
             ) {
            valid_option = 1;
        }

    } else if ( current_command == XESB_EXTRACT_STEGANOGRAPHY_BLOCK ) {

        if ( ( current_option_or_command == XESB_EMBEDDED_FILE ) ||
             ( current_option_or_command == XESB_BLOCK_FILE ) ) {
            valid_option = 1;
        }

    } else if ( current_command == XESR_EXTRACT_STEGANOGRAPHY_RAW ) {

        if ( ( current_option_or_command == XESR_EMBEDDED_FILE ) ||
             ( current_option_or_command == XESR_RAW_FILE ) ) {
            valid_option = 1;
        }

    }

    if ( valid_option == 0 ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "lexer error: option %s not recognized for command %s\n",
                  all_args[current_option_or_command], all_args[current_command] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( command_found == 1 ) {
        next_command_tmp = current_option_or_command;
        if ( ( ( current_command == XDC_DECODING_CONF ) || ( current_command == XEC_ENCODING_CONF )
               || ( current_command == XAC_ARITHMETIC_CONF ) || ( current_command == XSC_SEQUENCE_CONF )
               || ( current_command == XPC_PERMUTATION_CONF ) ) && ( ( next_command_tmp == XDC_DECODING_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XEC_ENCODING_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XAC_ARITHMETIC_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XSC_SEQUENCE_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XPC_PERMUTATION_CONF ) ) ) {
            if ( next_command_tmp < current_command ) {
                snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "lexer error: command %s should follow %s\n",
                          all_args[current_command], all_args[next_command_tmp] );
                XLEX_PRINT(  );
                return XRNL_ERROR;
            }

        }

        if ( ( ( current_command != XDC_DECODING_CONF ) && ( current_command != XEC_ENCODING_CONF )
               && ( current_command != XAC_ARITHMETIC_CONF ) && ( current_command != XSC_SEQUENCE_CONF )
               && ( current_command != XPC_PERMUTATION_CONF ) ) && ( ( next_command_tmp == XDC_DECODING_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XEC_ENCODING_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XAC_ARITHMETIC_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XSC_SEQUENCE_CONF )
                                                                     || ( next_command_tmp ==
                                                                          XPC_PERMUTATION_CONF ) )
             && ( current_command != XN_NULL )
             ) {
            snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                      "lexer error: configuration command %s should preceed %s\n", all_args[next_command_tmp],
                      all_args[current_command] );
            XLEX_PRINT(  );
            return XRNL_ERROR;
        }

        *next_command = next_command_tmp;
    }

    return XRNL_SUCCESS;

}

